From: Aaron Schulz Date: Sun, 30 Dec 2007 23:42:48 +0000 (+0000) Subject: Actually, keep "member" message the same and add "removable" message. List out the... X-Git-Tag: 1.31.0-rc.0~50216 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=eb158591609da0e0448c7c5cf584ee3943af2acb;p=lhc%2Fweb%2Fwiklou.git Actually, keep "member" message the same and add "removable" message. List out the member groups after the username. --- diff --git a/includes/SpecialUserrights.php b/includes/SpecialUserrights.php index 5dfe4dacb6..0394b7d85e 100644 --- a/includes/SpecialUserrights.php +++ b/includes/SpecialUserrights.php @@ -70,7 +70,7 @@ class UserrightsForm extends HTMLForm { $reason = $this->mRequest->getVal( 'user-reason' ); if( $wgUser->matchEditToken( $this->mRequest->getVal( 'wpEditToken' ), $username ) ) { $this->saveUserGroups( $username, - $this->mRequest->getArray( 'member' ), + $this->mRequest->getArray( 'removable' ), $this->mRequest->getArray( 'available' ), $reason ); } @@ -269,7 +269,12 @@ class UserrightsForm extends HTMLForm { global $wgOut, $wgUser; list( $addable, $removable ) = $this->splitGroups( $groups ); - + + $list = array(); + foreach( $user->getGroups() as $group ) + $list[] = self::buildGroupLink( $group ); + $grouplist = implode( ', ', $list ); + $wgOut->addHTML( Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->action, 'name' => 'editGroup' ) ) . Xml::hidden( 'user-editname', $user->getName() ) . @@ -278,6 +283,7 @@ class UserrightsForm extends HTMLForm { Xml::element( 'legend', array(), wfMsg( 'userrights-editusergroup' ) ) . wfMsgExt( 'editinguser', array( 'parse' ), wfEscapeWikiText( $user->getName() ) ) . + '

' . wfMsgHtml('userrights-groupsmember') . ' ' . $grouplist . '

' . $this->explainRights() . " @@ -314,6 +320,19 @@ class UserrightsForm extends HTMLForm { Xml::closeElement( 'form' ) . "\n" ); } + + /** + * Format a link to a group description page + * + * @param string $group + * @return string + */ + private static function buildGroupLink( $group ) { + static $cache = array(); + if( !isset( $cache[$group] ) ) + $cache[$group] = User::makeGroupLinkHtml( $group, User::getGroupMember( $group ) ); + return $cache[$group]; + } /** * Prepare a list of groups the user is able to add and remove @@ -343,7 +362,7 @@ class UserrightsForm extends HTMLForm { * @return string XHTML thingie where you can select what groups to add/remove * * @param array $groups The groups that can be added/removed - * @param string $name 'member' or 'available' + * @param string $name 'removable' or 'available' * @return string XHTML